<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import= "java.util.List,java.util.ArrayList" %>
<%@ page import= "OSMS.entity.Goods" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商品信息</title>
</head>
<body>
	<div>
		<!-- 根据商品的gname查找商品（可跨商家查询） -->
		<form action="getGoodsByGname" method="post">
			<input type="text" name="gname">		
			<input type="submit" value="查询">
		</form>
	</div>

	<table>
		<thead>
			<tr>
				<th>商品编号</th>
				<th>所属商家</th>
				<th>商品名称</th>
				<th>商品价格</th>
				<th>上架日期</th>
				<th>类别</th>
				<th>销量</th>
				<th>搜索量</th>
				<th>描述</th>
				<th>库存</th>
				<th>图片</th>
			</tr>
		</thead>
		<tbody>
			<!-- 循环输出BGListServet.java提供的goodsList中的所有信息，即输出商家旗下所有商品 -->
			<c:forEach items="${goodsList}" var="vo">
			<tr>
				<td>${vo.gid}</td>
				<td>${vo.bid}</td>
				<td>${vo.gname}</td>
				<td>${vo.gprice}</td>
				<td>${vo.uptime}</td>
				<td>${vo.gtype}</td>
				<td>${vo.sales}</td>
				<td>${vo.searchnum}</td>
				<td>${vo.gdetail}</td>
				<td>${vo.gstore}</td>
				<td>
					<div align="center">
					<img src="../img/${vo.picture}" style="width:150px;height:100px;"/>
					</div>
				
				</td>
				<td>
					<!-- 链接至ToGoodsUpdateServlet.java 实现该gid对应的商品的信息更新 -->
					<a href="toUpdate?gid=${vo.gid}&bid=${vo.bid}">更新</a>&nbsp;
					<!-- 链接至GoodsDeleteServlet.java 实现该gid对应的商品的信息删除 -->
					<!-- 注意此处传了两个值 -->
					<a href="delete?gid=${vo.gid}&bid=${vo.bid}">删除</a>
				</td>
			</tr>
			</c:forEach>
					<!-- 链接至GoodsInsertServlet.java 实现添加新商品（添加至当前登录商家旗下） -->
					
					<a href="insertgoods.jsp?bid=${goodsList[0].bid}">新增</a>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
					<a href="OrderList?bid=${goodsList[0].bid}">查看订单</a>
		</tbody>

		
	</table>
	
</body>
</html>